package com.example.practical_training_projects.service;

import com.example.practical_training_projects.entity.user;
import com.example.practical_training_projects.mapper.userMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class userServicelmpl implements userService{
    @Autowired
    private userMapper mapper;

    @Override
    public List<user> getAlluser() {
        return mapper.getAlluser();
    }

    @Override
    public PageInfo<user> finduserpage(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<user> lists=mapper.getAlluser();
        PageInfo<user> pageInfo=new PageInfo<>(lists);
        return pageInfo;
    }


    @Override
    public Integer insertUser(user user_uid) {
        return mapper.insertUser(user_uid);
    }

    @Override
    public Integer deleteUser(Integer user_uid) {
        return mapper.deleteUser(user_uid);
    }

    @Override
    public Integer updateUser(user user1) {
        return mapper.updateUser(user1);
    }

    @Override
    public user authenticateUser(String username, String password) {
        return mapper.authenticateUser(username, password);
    }

    @Override
    public List<user> getuserBYName(String user_name) {
        return mapper.getuserBYName(user_name);
    }

    @Override
    public user findUseruid(Integer user_uid) {
        return mapper.findUseruid(user_uid);
    }

    @Override
    public user getUserList(int page, int limit) {
        return mapper.getUserList(page,limit);
    }
}
